package com.wyu.servlet;

import com.wyu.dao.SelectDao;
import com.wyu.dao.SelectDaoImpl;
import com.wyu.pojo.YG;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
import java.util.List;

@WebServlet("/SelectGhServlet")
public class SelectGhServlet extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String ygh = request.getParameter("ygh");
        System.out.println("员工号"+ygh);
        HttpSession session = request.getSession();
        SelectDao dao = new SelectDaoImpl();
        List<YG> list2 = dao.searchygh(ygh);
        session.setAttribute("yg", list2);
        response.sendRedirect("ygxx.jsp");
    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        doPost(request,response);
    }
}
